import request from '@/utils/request'
import qs from 'qs'

const dictionaryApi = {
  /**
   * 新增
   * @param {*} data
   */
  add(data) {
    return request({ url: '/dictionary', method: 'post', data })
  },
  /**
   * 根据ID批量删除
   * @param {*} params
   */
  deleteByIds(params) {
    return request({
      url: '/dictionary',
      method: 'delete',
      params,
      paramsSerializer: params => {
        return qs.stringify(params, { indices: false })
      }
    })
  },
  /**
   * 修改
   * @param {*} data
   */
  edit(data) {
    return request({ url: '/dictionary', method: 'put', data })
  },
  /**
   * 查询分页列表
   * @param {*} params
   */
  listPage(params) {
    return request({ url: '/dictionary/page', method: 'get', params })
  },
  /**
   * 根据ID查询
   * @param {*} id
   */
  findById(id) {
    return request({ url: '/dictionary', method: 'get', params: { id } })
  }
}

export default dictionaryApi
